import  Vue from 'vue'
import  Vuex from 'vuex'
Vue.use(Vuex);
//使用vuex
export  default new Vuex.Store({//创建仓库
  //定义个公共数据
  state:{
    city:localStorage.city || "马全"

  },
  actions:{
    changeCity(ctx,city){
      ctx.commit('changeCity',city)
      console.log(city)
    }
  },
  mutations:{
    changeCity(state,city){
      state.city=city
      localStorage.city=city
    }
  }

})
